﻿using Microsoft.EntityFrameworkCore;
using System.Linq;
using MyCompanyName.MyProjectName.Layouts;
using MyCompanyName.MyProjectName.Menus;

namespace MyCompanyName.MyProjectName.EntityFrameworkCore
{
    public static class MyProjectNameEfCoreQueryableExtensions
    {

        public static IQueryable<Layout> IncludeDetails(this IQueryable<Layout> queryable, bool include = true)
        {
            if (!include)
            {
                return queryable;
            }

            return queryable;
        }

        public static IQueryable<Menu> IncludeDetails(this IQueryable<Menu> queryable, bool include = true)
        {
            if (!include)
            {
                return queryable;
            }

            return queryable;
        }

        public static IQueryable<Datas.Data> IncludeDetails(this IQueryable<Datas.Data> queryable, bool include = true)
        {
            if (!include)
            {
                return queryable;
            }
        
            return queryable
                .AsSplitQuery()
                .Include(x => x.Items);
        }
    }
}
